package cn.le.aopAnnotationDataSource.dao;

/**
 * Created by admin on 2017/3/28.
 */
import cn.le.aopAnnotationDataSource.annotation.DataSource;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;

public class JdbcDaoImpl{

    private JdbcTemplate jdbcTemplate;

    //@DataSource
    public List getMasterFirm()
    {
        String sql = " select * from m_firm t where t.firmid='1001' ";
        return  jdbcTemplate.queryForList(sql);
    }
    //@DataSource(value = DataSourceType.Slave)
    public List getSlaveFirm()
    {
        String sql = "select * from m_firm t where t.firmid='491' ";
        return jdbcTemplate.queryForList(sql);
    }

    @DataSource
    public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }
}
